package edu.upf.da.p2p.sm.server;

import org.jivesoftware.smack.filter.PacketFilter;
import org.jivesoftware.smack.filter.ThreadFilter;

import edu.upf.da.p2p.sm.client.message.AuthRequest;
import edu.upf.da.p2p.sm.server.manager.AuthManager;

/**
 * Esta es la implementacion de servidor para autorizaciones.
 * @author Grupo A.
 */
public class AuthServer extends P2PGenericServer{

	public AuthServer() {
		super("auth");
		authListener = new AuthManager(this);
	}

	private AuthManager authListener;

	protected void setListeners() {

		PacketFilter filterf = new ThreadFilter(AuthRequest.class.getCanonicalName());
		con.createPacketCollector(filterf);
		con.addPacketListener(authListener, filterf);

		presenceListener.linkTo(authListener);
	}

	public AuthManager getAuthManager(){
		return authListener;
	}
}
